load("@rules_license//rules:license.bzl", "license")
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")

package(
    default_applicable_licenses = [":license"],
    default_visibility = ["//visibility:public"],
)

exports_files(["LICENSE"])

license(
    name = "license",
    package_name = "aom",
    license_kinds = [
        "@rules_license//licenses/spdx:BSD-3-Clause",
    ],
    license_text = "LICENSE",
    package_url = "https://aomedia.googlesource.com/aom",
)

filegroup(
    name = "all_srcs",
    srcs = glob(["**"]),
)

cmake(
    name = "aom",
    build_data = [
        "@nasm",
    ],
    cache_entries = {
        "BUILD_SHARED_LIBS": "OFF",
        "ENABLE_DOCS": "OFF",
        "ENABLE_EXAMPLES": "OFF",
        "ENABLE_TESTS": "OFF",
        "ENABLE_TOOLS": "OFF",
    },
    env = {
        "CMAKE_BUILD_TYPE": "Release",
        "CMAKE_BUILD_PARALLEL_LEVEL": "4",
        "PATH": "$$PATH:$$(dirname $(execpath @nasm))",
    },
    lib_source = ":all_srcs",
    out_static_libs = ["libaom.a"],
)
